package top.vains.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import top.vains.entity.RolePermission;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author vains
 * @since 2020-02-17
 */
public interface RolePermissionMapper extends BaseMapper<RolePermission> {

    /**
     * 根据角色ID查询角色已拥有的权限
     * @param roleId 角色ID
     * @return 权限ID
     */
    @Select("SELECT pid FROM ROLE_PERMISSION WHERE ROLE_ID = #{roleId}")
    List<Integer> getRolePermissionId(Integer roleId);

}
